package com.wr.controller;

import com.wr.model.Article;
import com.wr.service.article.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author weirong
 * @Title:
 * @Description:首页
 * @date 2018/6/615:25
 */
@Controller
public class IndexController {

    @Autowired
    private ArticleService articleService;

    @RequestMapping("/")
    public String index(Model model) {

        List<Article> articles = articleService.mainList(1,10);
        model.addAttribute("articles",articles);
        return "main";
    }
}
